<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <h3>{{firstname}} {{lastname}}</h3>
    <h3>{{firstname+' '+lastname}}</h3>
    <h3>{{getName()}}</h3>
    <h3>{{fullName}}</h3>
  </div>
  <script src="../../vue.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        firstname: "Kobe",
        lastname: "Bryant"
      },
      methods: {
        getName() {
          return this.firstname + this.lastname
        }
      },
      computed: {
        // 计算属性 当作属性使用
        fullName: function () {
          return this.firstname + this.lastname
        }
      }
    })
  </script>
</body>

</html>